<?php

namespace backend\modules\goods\models;

use Yii;

/**
 * This is the model class for table "attrvalue_goods".
 *
 * @property string $attr_value_goods_id
 * @property string $attr_id
 * @property string $attr_name
 * @property string $attr_value_id
 * @property string $attr_value_name
 * @property string $goods_id
 * @property string $attr_cat_id
 * @property string $attr_value_string
 */
class AttrvalueGoods extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'attrvalue_goods';
    }

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
//            TimestampBehavior::className(),
            // 名为myBehavior4的行为，也是给出了MyBehavior类的配置数组
            'uuid' => [
                'class' => \common\behavior\uuidBehavior::className(),
                'owner' => $this
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ['attr_value_goods_id','default','value'=>$this->getUUID()],
            [['attr_value_goods_id', 'attr_id', 'attr_name', 'attr_value_id', 'attr_value_name', 'goods_id'], 'required'],
            [['attr_value_goods_id', 'attr_value_id', 'goods_id','attr_cat_id'], 'string', 'max' => 40],
            [['attr_id', 'attr_name', 'attr_value_name'], 'string', 'max' => 255],
            [[ 'attr_value_string'], 'string', 'max' => 200],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'attr_value_goods_id' => Yii::t('app', 'Attr Value Goods ID'),
            'attr_id' => Yii::t('app', 'Attr ID'),
            'attr_name' => Yii::t('app', 'Attr Name'),
            'attr_value_id' => Yii::t('app', 'Attr Value ID'),
            'attr_value_name' => Yii::t('app', 'Attr Value Name'),
            'goods_id' => Yii::t('app', 'Goods ID'),
            'attr_cat_id'=>Yii::t('app', 'attr_cat_id'),
            'attr_value_string'=>Yii::t('app', 'attr_value_string'),
        ];
    }

    /**
     * @inheritdoc
     * @return \backend\modules\goods\models\query\AttrvalueGoodsQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new \backend\modules\goods\models\query\AttrvalueGoodsQuery(get_called_class());
    }
}
